before{
  initMocks(this);
  when(exchange.getIn()).thenReturn(msg);
  db=new EmbeddedGraphDatabase(getRandomStore());
}
getRandomStore{
  File file=File.createTempFile("prefix","suffix").getParentFile();
  File dir=new File(file.getAbsolutePath() + "/neo4j-test-" + UUID.randomUUID());
  dir.mkdir();
  return dir.getAbsolutePath();
}
testCreateNodeEmptyBody{
  when(msg.getHeader(Neo4jEndpoint.HEADER_OPERATION)).thenReturn(Neo4jOperation.CREATE_NODE);
  Node node=mock(Node.class);
  when(node.getId()).thenReturn(14L);
  org.springframework.data.neo4j.support.Neo4jTemplate.createNode
  producer.process(exchange);
  org.springframework.data.neo4j.support.Neo4jTemplate.createNode
  verify(msg).setHeader(Neo4jEndpoint.HEADER_NODE_ID,14L);
}
testCreateNodePropertiesBody{
  when(msg.getHeader(Neo4jEndpoint.HEADER_OPERATION)).thenReturn(Neo4jOperation.CREATE_NODE);
  when(msg.getBody()).thenReturn(new HashMap<String,Object>());
  Node node=mock(Node.class);
  when(node.getId()).thenReturn(14L);
  org.springframework.data.neo4j.support.Neo4jTemplate.createNode
  producer.process(exchange);
  org.springframework.data.neo4j.support.Neo4jTemplate.createNode
  verify(msg).setHeader(Neo4jEndpoint.HEADER_NODE_ID,14L);
}
testCreateRelationshipWithBasicBody{
  when(msg.getHeader(Neo4jEndpoint.HEADER_OPERATION)).thenReturn(Neo4jOperation.CREATE_RELATIONSHIP);
  Node start=mock(Node.class);
  Node end=mock(Node.class);
  String type="friendswith";
  BasicRelationship br=new BasicRelationship(start,end,type);
  when(msg.getBody()).thenReturn(br);
  Relationship r=mock(Relationship.class);
  when(r.getId()).thenReturn(99L);
  org.springframework.data.neo4j.support.Neo4jTemplate.createRelationshipBetween
  org.springframework.data.neo4j.support.Neo4jTemplate.createRelationshipBetween
  verify(msg).setHeader(Neo4jEndpoint.HEADER_RELATIONSHIP_ID,99L);
}
testCreateRelationshipWithSpringBody{
  when(msg.getHeader(Neo4jEndpoint.HEADER_OPERATION)).thenReturn(Neo4jOperation.CREATE_RELATIONSHIP);
  Object start=new Object();
  Object end=new Object();
  Class<Relationship> entityClass=Relationship.class;
  String type="friendswith";
  SpringDataRelationship<Relationship> spring=new SpringDataRelationship<Relationship>(start,end,entityClass,type,true);
  when(msg.getBody()).thenReturn(spring);
  Relationship r=mock(Relationship.class);
  when(r.getId()).thenReturn(55L);
  org.springframework.data.neo4j.support.Neo4jTemplate.createRelationshipBetween
  org.springframework.data.neo4j.support.Neo4jTemplate.createRelationshipBetween
  verify(msg).setHeader(Neo4jEndpoint.HEADER_RELATIONSHIP_ID,55L);
}
testNullOperationFails{
  producer.process(exchange);
}
testRemoveNodeBasicBody{
  Node node=mock(Node.class);
  when(node.getId()).thenReturn(14L);
  when(msg.getHeader(Neo4jEndpoint.HEADER_OPERATION)).thenReturn(Neo4jOperation.REMOVE_NODE);
  when(msg.getBody()).thenReturn(node);
  producer.process(exchange);
  verify(template).delete(node);
}
testRemoveNodeById{
  Node node=mock(Node.class);
  org.springframework.data.neo4j.support.Neo4jTemplate.getNode
  when(msg.getHeader(Neo4jEndpoint.HEADER_OPERATION)).thenReturn(Neo4jOperation.REMOVE_NODE);
  when(msg.getBody()).thenReturn(44L);
  producer.process(exchange);
  verify(template).delete(node);
}
testRemoveRelationshipByBasic{
  Relationship r=mock(Relationship.class);
  when(msg.getHeader(Neo4jEndpoint.HEADER_OPERATION)).thenReturn(Neo4jOperation.REMOVE_RELATIONSHIP);
  when(msg.getBody()).thenReturn(r);
  producer.process(exchange);
  verify(template).delete(r);
}
testRemoveRelationshipById{
  Relationship r=mock(Relationship.class);
  org.springframework.data.neo4j.support.Neo4jTemplate.getRelationship
  when(msg.getHeader(Neo4jEndpoint.HEADER_OPERATION)).thenReturn(Neo4jOperation.REMOVE_RELATIONSHIP);
  when(msg.getBody()).thenReturn(51L);
  producer.process(exchange);
  verify(template).delete(r);
}
testRemoveRelationshipBySpringData{
  Object start=new Object();
  Object end=new Object();
  Class<String> entityClass=String.class;
  String type="friendswith";
  SpringDataRelationship<String> spring=new SpringDataRelationship<String>(start,end,entityClass,type,true);
  when(msg.getHeader(Neo4jEndpoint.HEADER_OPERATION)).thenReturn(Neo4jOperation.REMOVE_RELATIONSHIP);
  when(msg.getBody()).thenReturn(spring);
  verify(template).deleteRelationshipBetween(start,end,type);
}
testUnsupportedBodyForCreateNode{
  when(msg.getHeader(Neo4jEndpoint.HEADER_OPERATION)).thenReturn(Neo4jOperation.CREATE_NODE);
  when(msg.getBody()).thenReturn(new Object());
  producer.process(exchange);
}
testUnsupportedBodyForCreateRelationship{
  when(msg.getHeader(Neo4jEndpoint.HEADER_OPERATION)).thenReturn(Neo4jOperation.CREATE_RELATIONSHIP);
  when(msg.getBody()).thenReturn(new Object());
  producer.process(exchange);
}
testUnsupportedBodyForDeleteNode{
  when(msg.getHeader(Neo4jEndpoint.HEADER_OPERATION)).thenReturn(Neo4jOperation.REMOVE_NODE);
  when(msg.getBody()).thenReturn(new Object());
  producer.process(exchange);
}
testUnsupportedBodyForDeleteRelationship{
  when(msg.getHeader(Neo4jEndpoint.HEADER_OPERATION)).thenReturn(Neo4jOperation.REMOVE_RELATIONSHIP);
  when(msg.getBody()).thenReturn(new Object());
  producer.process(exchange);
}
